import React,{ Suspense } from "react"
import { BrowserRouter as Router,Route,Switch  } from "react-router-dom"

import routerMap from "./routerMap"

const App = () => {
    return (
        <Suspense fallback={<div>loading</div>}>
            <Router>
                <Switch>
                    {
                        routerMap.map( element => {
                            return (
                                <Route 
                                    exact
                                    key={element.path}
                                    path={element.path}
                                    component={element.componet}
                                />
                            )
                        } )
                    }
                </Switch>
            </Router>
        </Suspense>
    )
}
export default App